﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WRJClient.Common;
using WRJClient.ViewModel;
using LiveCharts;
using LiveCharts.Defaults;

namespace WRJClient.UI.SystemMonitor
{
    /// <summary>
    /// AnalyticView.xaml 的交互逻辑
    /// </summary>
    public partial class AnalyticView : UserControl
    {
        public int WorkStationCount
        {
            get { return WorkStationManager.Instance.Count; }
        }
        public int ControlCenterCount
        {
            get { return ControlCenterManager.Instance.Count; }
        }
        public int TotalCount
        {
            get { return WorkStationCount + ControlCenterCount; }
        }
        public int UavCount
        {
            get { return UAVManager.Instance.Count; }
        }
        public int MissionTotalCount
        {
            get { return MissionManager.Instance.Count; }
        }
        public int MissionTempCount
        {
            get { return MissionManager.Instance.Datas.Count(m => m.TypeName == "临时"); }
        }
        public int MissionDailyCount
        {
            get { return MissionManager.Instance.Datas.Count(m => m.TypeName == "例行"); }
        }
        public ChartValues<ObservableValue> InfomationLevel1Count
        {
            get { return new ChartValues<ObservableValue> { new ObservableValue(InfomationManager.Instance.Datas.Count(m => m.StaticData.Priority == 1)) }; }
        }
        public ChartValues<ObservableValue> InfomationLevel2Count
        {
            get { return new ChartValues<ObservableValue> { new ObservableValue(InfomationManager.Instance.Datas.Count(m => m.StaticData.Priority == 2)) }; }
        }
        public ChartValues<ObservableValue> InfomationLevel3Count
        {
            get { return new ChartValues<ObservableValue> { new ObservableValue(InfomationManager.Instance.Datas.Count(m => m.StaticData.Priority == 3)) }; }
        }
        public ChartValues<ObservableValue> InfomationLevel4Count
        {
            get { return new ChartValues<ObservableValue> { new ObservableValue(InfomationManager.Instance.Datas.Count(m => m.StaticData.Priority == 0)) }; }
        }


        public AnalyticView()
        {
            InitializeComponent();
            init();
        }

        private void init()
        {
            DataContext = this;

            List<MissionViewModel> list = new List<MissionViewModel>();
            foreach (var item in MissionManager.Instance.Datas)
            {
                if (item.IsAction)
                {
                    list.Add(item);
                }
            }
            missionListView.ItemsSource = list;
        }
    }

}
